package com.base.log.testlog;

import com.alibaba.fastjson2.JSONObject;
import com.base.log.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.ArrayList;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;

/**
 * @Author:sjb
 * @CreateTime:2024-08-21
 * @Description: 测试日志类
 * @Version：1.0
 */
public class TestLog {

    private static final org.slf4j.Logger log = LoggerFactory.getLogger(TestLog.class);

    public static void main(String[] args) throws IOException {
        List<String> testList = new ArrayList<String>();
        testList.add("aaa");
        testList.add("bbb");
        testList.add("ccc");
        testList.add("ddd");
        try {
            for (String testS : testList) {
                if ("aaa".equals(testS)) {
                    testList.remove(testS);
                }
            }
            testList.forEach(System.out::println);
        } catch (ConcurrentModificationException e) {
            log.error("删除元素错误：{}", e.getMessage());
            e.printStackTrace();
        }

/*        Iterator<String> testIterator = testList.iterator();
        while (testIterator.hasNext()){
            String nextString = testIterator.next();
            if ("aaa".equals(nextString)){
                testIterator.remove();
            }
        }
        testList.forEach(System.out::println);*/
    }
}
